package cn.gson.springboot.controller;

import cn.gson.springboot.model.pojos.ApprovalRecord;
import cn.gson.springboot.model.service.ApprovalRecordService;
import cn.gson.springboot.model.vo.ApprovalRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class ApprovalRecordController {
    @Autowired
    ApprovalRecordService appRecordService;

    //查询报价单所有审批记录集合
    @RequestMapping("/app-record-quo-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByQuoId(Integer quoId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByQuoId(quoId);
        return app;
    }
    //查询报价处于待审批状态的审批记录
    @RequestMapping("/app-record-quo-app")
    @ResponseBody
    public ApprovalRecord approvalRecordByQuoAppId(Integer quoId){
        ApprovalRecord  app = appRecordService.selectAppRecordByQuoAppId(quoId);
        return app;
    }

    //查询出差单所有审批记录集合
    @RequestMapping("/app-record-bus-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByBusId(Integer businessId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByBusId(businessId);
        return app;
    }
    //查询报价处于待审批状态的审批记录
    @RequestMapping("/app-record-bus-app")
    @ResponseBody
    public ApprovalRecord selectAppRecordByBusAppId(Integer businessId){
        ApprovalRecord  app = appRecordService.selectAppRecordByBusAppId(businessId);
        return app;
    }
    //查询出采购所有审批记录集合
    @RequestMapping("/app-record-pur-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByPurId(Integer purId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByPurId(purId);
        return app;
    }
    //查询采购处于待审批状态的审批记录
    @RequestMapping("/app-record-pur-app")
    @ResponseBody
    public ApprovalRecord selectAppRecordByPurAppId(Integer purId){
        ApprovalRecord  app = appRecordService.selectAppRecordByPurAppId(purId);
        return app;
    }
    //查询合同所有审批记录集合
    @RequestMapping("/app-record-con-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByConId(Integer conId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByConId(conId);
        return app;
    }
    //查询合同处于待审批状态的审批记录
    @RequestMapping("/app-record-con-app")
    @ResponseBody
    public ApprovalRecord selectAppRecordByConAppId(Integer conId){
        ApprovalRecord  app = appRecordService.selectAppRecordByConAppId(conId);
        return app;
    }
    //查询付款计划所有审批记录集合
    @RequestMapping("/app-record-pay-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByPayId(Integer payId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByPayId(payId);
        return app;
    }
    //查询付款计划处于待审批状态的审批记录
    @RequestMapping("/app-record-pay-app")
    @ResponseBody
    public ApprovalRecord selectAppRecordByPayAppId(Integer payId){
        ApprovalRecord  app = appRecordService.selectAppRecordByPayAppId(payId);
        return app;
    }

    //新增审批记录
    @PostMapping("/save-app-record")
    @ResponseBody
    public void saveAppRecord(@RequestBody ApprovalRecordVo vo){
        appRecordService.saveAppRecord(vo);
    }

    //查询合同订单所有审批记录集合
    @RequestMapping("/app-record-contract-list")
    @ResponseBody
    public List<ApprovalRecord> approvalRecordByContractId(Integer contractId){
        List<ApprovalRecord>  app = appRecordService.selectAllAppRecordByContractId(contractId);
        return app;
    }
}
